package com.cspg.ssss.service;

import com.alibaba.fastjson.JSONObject;
import com.cspg.ssss.config.WeixinProperties;
import com.cspg.ssss.domain.CheckBatchInst;
import com.cspg.ssss.repository.DepartmentUserRepository;
import com.cspg.ssss.util.DateUtil;
import com.cspg.ssss.util.HttpRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

@Service
public class WxSendMsgService {

    private static final Logger log = LoggerFactory.getLogger(WxSendMsgService.class);

    @Value("${front-url}")
    private String frontUrl;

    @Autowired
    WeixinService wxService;

    @Autowired
    WeixinProperties wxProperties;

    @Autowired
    CheckBatchService checkBatchService;

    @Autowired
    GradeRoleUserService gradeRoleUserService;

    //elink发送工具函数
    public String sendTextMsg2(String userids, String partids, String title, String content) {

        JSONObject requestobj = new JSONObject();

        if (userids != null && userids.length() > 0) {
            requestobj.put("touser", userids);
        }

        if (partids != null && partids.length() > 0) {
            requestobj.put("toparty", partids);
        }

        requestobj.put("msgtype", "text");
        requestobj.put("agentid", wxProperties.getAgentId());

        JSONObject contentObj = new JSONObject();
        String sendtitle = title + "<br>";

        Date curr = DateUtil.getCurrentDate();

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        String dtStr = sdf.format(curr);
        String c = ",<a href=\"" + frontUrl + "?flag=1\">点击进入待办事项</a>。";
        String sendBody = content;
        contentObj.put("content", sendtitle + sendBody + c);

        requestobj.put("text", contentObj);

        String token = wxService.getToken(wxProperties.getCorpid(), wxProperties.getSecret());
        String url = wxProperties.getUrlroot() + "/cgi-bin/message/send?access_token=" + token;
        log.debug("begin sendTextMsg：" + requestobj.toJSONString());
        JSONObject retObj = HttpRequest.httpsPostRequest(url, requestobj);
        log.debug("end sendTextMsg：" + retObj.toJSONString());
        int ret = retObj.getIntValue("errcode");
        if (ret == 0 && retObj.getString("invaliduser") == null) {
            return "0发送成功!";
        } else {
            return String.valueOf(ret) + retObj.getString("errmsg") + retObj.getString("invaliduser");
        }

    }

    public String sendTextMsgByList(List<String> userids, List<String> partids, String title, String content) {
        String struserids = "";
        if (userids != null && userids.size() > 0) {
            for (int i = 0; i < userids.size(); i++) {

                if (i == 0) {
                    struserids = userids.get(i);
                } else {
                    struserids += "|" + userids.get(i);
                }
            }
        }
        String strpartids = "";

        if (partids != null && partids.size() > 0) {
            for (int i = 0; i < partids.size(); i++) {
                if (i == 0) {
                    strpartids = partids.get(i);
                } else {
                    strpartids += partids.get(i) + "|";
                }
            }
        }

        return sendTextMsg2(struserids, strpartids, title, content);
    }

    /**
     * 打分审核拒绝消息
     *
     * @param userids
     * @param check_type
     */
    public void sendRejectTip(List<String> userids, int check_type) {
        CheckBatchInst inst0 = checkBatchService.getCurrentCheckBachInst(check_type);
        if (inst0 == null) {
            log.info("当前无类型为" + String.valueOf(check_type) + "的批次");
            return;
        }

        JSONObject configObj = JSONObject.parseObject(inst0.getConfig());
        int upload_days = configObj.getIntValue("upload_problem");
        int grade_days = configObj.getIntValue("grade");
        int feedback_days = configObj.getIntValue("feedback");
        int review_days = configObj.getIntValue("review");

        String title = "";
        String msgContent = "";

        Date curr = DateUtil.getCurrentDate();
        Date lastupdate = inst0.getUpdate_time();
        Date endDate = DateUtil.dayAddNum(lastupdate, upload_days + grade_days);
        String strEndDate = DateUtil.toDateString(endDate);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        String dtStr = sdf.format(curr);

        if (inst0.getCheck_type() == 0) {
            title = "【超高压输电公司对各单位安全生产过程考核评价-考核评分(回退)】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域公司对各单位专业检查发现问题考核评分";
        } else {
            title = "【单位对各部门安全生产过程考核评价-考核评分(回退)】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域单位对各部门专业检查发现问题考核评分";
        }
        sendTextMsgByList(userids, null, title, msgContent);
    }

    /**
     * 打分审核代办通知消息
     *
     * @param userids
     * @param check_type
     */
    public void sendCheckTipInfo(List<String> userids, int check_type) {

        CheckBatchInst inst0 = checkBatchService.getCurrentCheckBachInst(check_type);
        if (inst0 == null) {
            log.info("当前无类型为" + String.valueOf(check_type) + "的批次");
            return;
        }

        JSONObject configObj = JSONObject.parseObject(inst0.getConfig());
        int upload_days = configObj.getIntValue("upload_problem");
        int grade_days = configObj.getIntValue("grade");
        int feedback_days = configObj.getIntValue("feedback");
        int review_days = configObj.getIntValue("review");

        String title = "";
        String msgContent = "";

        Date curr = DateUtil.getCurrentDate();
        Date lastupdate = inst0.getUpdate_time();
        Date endDate = DateUtil.dayAddNum(lastupdate, upload_days + grade_days);
        String strEndDate = DateUtil.toDateString(endDate);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        String dtStr = sdf.format(curr);

        if (inst0.getCheck_type() == 0) {
            title = "【超高压输电公司对各单位安全生产过程考核评价-评分审核】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域公司对各单位专业检查发现问题评分审核";
        } else {
            title = "【单位对各部门安全生产过程考核评价-评分审核】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域单位对各部门专业检查发现问题评分审核";
        }
        sendTextMsgByList(userids, null, title, msgContent);

    }

    /**
     * 反馈审核通知消息
     *
     * @param userids
     * @param check_type
     */
    public void sendApproveTipInfo(List<String> userids, int check_type) {

        CheckBatchInst inst0 = checkBatchService.getCurrentCheckBachInst(check_type);
        if (inst0 == null) {
            log.info("当前无类型为" + String.valueOf(check_type) + "的批次");
            return;
        }

        JSONObject configObj = JSONObject.parseObject(inst0.getConfig());
        int upload_days = configObj.getIntValue("upload_problem");
        int grade_days = configObj.getIntValue("grade");
        int feedback_days = configObj.getIntValue("feedback");
        int review_days = configObj.getIntValue("review");

        String title = "";
        String msgContent = "";

        Date curr = DateUtil.getCurrentDate();
        Date lastupdate = inst0.getUpdate_time();
        Date endDate = DateUtil.dayAddNum(lastupdate, feedback_days);
        String strEndDate = DateUtil.toDateString(endDate);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        String dtStr = sdf.format(curr);

        if (inst0.getCheck_type() == 0) {
            title = "【超高压输电公司对各单位安全生产过程考核评价-反馈审核】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域公司对各单位专业检查发现问题反馈审核";
        } else {
            title = "【单位对各部门安全生产过程考核评价-反馈审核】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域单位对各部门专业检查发现问题反馈审核";
        }
        sendTextMsgByList(userids, null, title, msgContent);

    }

    /**
     * 局领导反馈审核通知消息
     *
     * @param userids
     * @param check_type
     */
    public void sendApproveReviewTipInfo(List<String> userids, int check_type) {

        CheckBatchInst inst0 = checkBatchService.getCurrentCheckBachInst(check_type);
        if (inst0 == null) {
            log.info("当前无类型为" + String.valueOf(check_type) + "的批次");
            return;
        }

        JSONObject configObj = JSONObject.parseObject(inst0.getConfig());
        int upload_days = configObj.getIntValue("upload_problem");
        int grade_days = configObj.getIntValue("grade");
        int feedback_days = configObj.getIntValue("feedback");
        int review_days = configObj.getIntValue("review");

        String title = "";
        String msgContent = "";

        Date curr = DateUtil.getCurrentDate();
        Date lastupdate = inst0.getUpdate_time();
        Date endDate = DateUtil.dayAddNum(lastupdate, feedback_days);
        String strEndDate = DateUtil.toDateString(endDate);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        String dtStr = sdf.format(curr);

        if (inst0.getCheck_type() == 0) {
            title = "【超高压输电公司对各单位安全生产过程考核评价-反馈复核】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域公司对各单位专业检查发现问题反馈复核";
        } else {
            title = "【单位对各部门安全生产过程考核评价-反馈审核】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域单位对各部门专业检查发现问题反馈复核";
        }
        sendTextMsgByList(userids, null, title, msgContent);

    }

    /**
     * 反馈审核拒绝通知消息
     *
     * @param userids
     * @param check_type
     */
    public void sendApproveRejectTipInfo(List<String> userids, int check_type) {

        CheckBatchInst inst0 = checkBatchService.getCurrentCheckBachInst(check_type);
        if (inst0 == null) {
            log.info("当前无类型为" + String.valueOf(check_type) + "的批次");
            return;
        }

        JSONObject configObj = JSONObject.parseObject(inst0.getConfig());
        int upload_days = configObj.getIntValue("upload_problem");
        int grade_days = configObj.getIntValue("grade");
        int feedback_days = configObj.getIntValue("feedback");
        int review_days = configObj.getIntValue("review");

        String title = "";
        String msgContent = "";

        Date curr = DateUtil.getCurrentDate();
        Date lastupdate = inst0.getUpdate_time();
        Date endDate = DateUtil.dayAddNum(lastupdate, feedback_days);
        String strEndDate = DateUtil.toDateString(endDate);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        String dtStr = sdf.format(curr);

        if (inst0.getCheck_type() == 0) {
            title = "【超高压输电公司对各单位安全生产过程考核评价-确认考核评分（回退）】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域公司对各单位专业检查发现问题的评分确认";
        } else {
            title = "【单位对各部门安全生产过程考核评价-确认考核评分（回退）】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域单位对各部门专业检查发现问题的评分确认";
        }
        sendTextMsgByList(userids, null, title, msgContent);

    }

    /**
     * 反馈同意重新打分通知消息
     *
     * @param userids
     * @param check_type
     */
    public void feedbackGradeTipInfo(List<String> userids, int check_type) {

        CheckBatchInst inst0 = checkBatchService.getCurrentCheckBachInst(check_type);
        if (inst0 == null) {
            log.info("当前无类型为" + String.valueOf(check_type) + "的批次");
            return;
        }

        JSONObject configObj = JSONObject.parseObject(inst0.getConfig());
        int upload_days = configObj.getIntValue("upload_problem");
        int grade_days = configObj.getIntValue("grade");
        int feedback_days = configObj.getIntValue("feedback");
        int review_days = configObj.getIntValue("review");

        String title = "";
        String msgContent = "";

        Date curr = DateUtil.getCurrentDate();
        Date lastupdate = inst0.getUpdate_time();
        Date endDate = DateUtil.dayAddNum(lastupdate, review_days);
        String strEndDate = DateUtil.toDateString(endDate);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        String dtStr = sdf.format(curr);

        if (inst0.getCheck_type() == 0) {
            title = "【超高压输电公司对各单位安全生产过程考核评价-考核评分（反馈）】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域公司对各单位专业检查发现问题的考核评分";
        } else {
            title = "【单位对各部门安全生产过程考核评价-考核评分（反馈）】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域单位对各部门专业检查发现问题的考核评分";
        }
        sendTextMsgByList(userids, null, title, msgContent);

    }

    /**
     * 反馈审核最终审核（反馈终审）
     */
    public void lastReviewTipInfo(List<String> userids, int check_type) {
        CheckBatchInst inst0 = checkBatchService.getCurrentCheckBachInst(check_type);
        if (inst0 == null) {
            log.info("当前无类型为" + check_type + "的批次");
            return;
        }
        JSONObject configObj = JSONObject.parseObject(inst0.getConfig());
        int review_days = configObj.getIntValue("review");
        Date lastupdate = inst0.getStart_date();
        Date endDate = DateUtil.dayAddNum(lastupdate, review_days);
        String strEndDate = DateUtil.toDateString(endDate);

        String title;
        String msgContent;
        if (inst0.getCheck_type() == 0) {
            title = "【超高压输电公司对各单位安全生产过程考核评价-反馈终核】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域公司对各单位专业检查发现问题反馈终核";
        } else {
            title = "【单位对各部门安全生产过程考核评价-反馈终核】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域单位对各部门专业检查发现问题反馈终核";
        }
        sendTextMsgByList(userids, null, title, msgContent);
    }

    /**
     * @param userids
     * @param result
     */
    public void feedbackReviewTipInfo(List<String> userids, int result) {
        String title = "";
        String msgContent = "";

        if (result == 0) {
            title = "【超高压输电公司对各单位安全生产过程考核评价-反馈结果】";
            msgContent = "本业务领域公司对各单位专业检查发现问题的反馈结果为拒绝";
        } else {
            title = "【单位对各部门安全生产过程考核评价-反馈结果】";
            msgContent = "本业务领域公司对各单位专业检查发现问题的反馈结果为同意";
        }
        sendTextMsgByList(userids, null, title, msgContent);

    }

    /**
     * 加分申请审核通知
     *
     * @param userids
     * @param check_type
     */
    public void addScoreApplyCheckTipInfo(List<String> userids, int check_type) {

        CheckBatchInst inst0 = checkBatchService.getCurrentCheckBachInst(check_type);
        if (inst0 == null) {
            log.info("当前无类型为" + String.valueOf(check_type) + "的批次");
            return;
        }

        JSONObject configObj = JSONObject.parseObject(inst0.getConfig());
        int add_score_apply_days = configObj.getIntValue("add_score_apply");
        int add_score_review_days = configObj.getIntValue("add_score_review");

        String title = "";
        String msgContent = "";

        Date curr = DateUtil.getCurrentDate();
        Date lastupdate = inst0.getStart_date();
        Date endDate = DateUtil.dayAddNum(lastupdate, add_score_apply_days);
        String strEndDate = DateUtil.toDateString(endDate);

        if (inst0.getCheck_type() == 0) {
            title = "【超高压输电公司对各单位安全生产过程考核评价-加分审核】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域加分申请审核";
        } else {
            title = "【单位对各部门安全生产过程考核评价-加分审核】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域加分申请审核";
        }
        sendTextMsgByList(userids, null, title, msgContent);

    }

    /**
     * 加分审核拒绝通知消息
     *
     * @param userids
     * @param check_type
     */
    public void addScoreApplyCheckRejectTipInfo(List<String> userids, int check_type) {

        CheckBatchInst inst0 = checkBatchService.getCurrentCheckBachInst(check_type);
        if (inst0 == null) {
            log.info("当前无类型为" + String.valueOf(check_type) + "的批次");
            return;
        }

        JSONObject configObj = JSONObject.parseObject(inst0.getConfig());
        int add_score_apply_days = configObj.getIntValue("add_score_apply");
        int add_score_review_days = configObj.getIntValue("add_score_review");

        String title = "";
        String msgContent = "";

        Date curr = DateUtil.getCurrentDate();
        Date lastupdate = inst0.getStart_date();
        Date endDate = DateUtil.dayAddNum(lastupdate, add_score_apply_days);
        String strEndDate = DateUtil.toDateString(endDate);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        String dtStr = sdf.format(curr);

        if (inst0.getCheck_type() == 0) {
            title = "【超高压输电公司对各单位安全生产过程考核评价-加分申请（回退）】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域加分申请修改或取消本次加分申请";
        } else {
            title = "【单位对各部门安全生产过程考核评价-加分申请（回退）】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域加分申请修改或取消本次加分申请";
        }
        sendTextMsgByList(userids, null, title, msgContent);

    }

    /**
     * 加分申请局领导审核（加分审核）
     *
     * @param userids
     * @param check_type
     */
    public void addScoreApplyApproveReviewTipInfo(List<String> userids, int check_type) {

        CheckBatchInst inst0 = checkBatchService.getCurrentCheckBachInst(check_type);
        if (inst0 == null) {
            log.info("当前无类型为" + String.valueOf(check_type) + "的批次");
            return;
        }

        JSONObject configObj = JSONObject.parseObject(inst0.getConfig());
        int add_score_apply_days = configObj.getIntValue("add_score_apply");
        int add_score_review_days = configObj.getIntValue("add_score_review");

        String title = "";
        String msgContent = "";

        Date curr = DateUtil.getCurrentDate();
        Date lastupdate = inst0.getStart_date();
        Date endDate = DateUtil.dayAddNum(lastupdate, add_score_apply_days);
        String strEndDate = DateUtil.toDateString(endDate);

        if (inst0.getCheck_type() == 0) {
            title = "【超高压输电公司对各单位安全生产过程考核评价-加分复核】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域加分申请复核";
        } else {
            title = "【单位对各部门安全生产过程考核评价-加分审核】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域加分申请复核";
        }
        sendTextMsgByList(userids, null, title, msgContent);

    }

    /**
     * 加分申请最终审核（加分终审）
     */
    public void addScoreApplyApproveLastReviewTipInfo(List<String> userids, int check_type) {

        CheckBatchInst inst0 = checkBatchService.getCurrentCheckBachInst(check_type);
        if (inst0 == null) {
            log.info("当前无类型为" + check_type + "的批次");
            return;
        }
        JSONObject configObj = JSONObject.parseObject(inst0.getConfig());
        int add_score_review_days = configObj.getIntValue("add_score_review");
        Date lastupdate = inst0.getStart_date();
        Date endDate = DateUtil.dayAddNum(lastupdate, add_score_review_days);
        String strEndDate = DateUtil.toDateString(endDate);

        String title;
        String msgContent;
        if (inst0.getCheck_type() == 0) {
            title = "【超高压输电公司对各单位安全生产过程考核评价-加分终核】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域加分申请最终审核";
        } else {
            title = "【单位对各部门安全生产过程考核评价-加分终核】";
            msgContent = "请于" + strEndDate + "之前，完成本业务领域加分申请最终审核";
        }
        sendTextMsgByList(userids, null, title, msgContent);

    }


    /**
     * 整改措施指定（待制定）
     *
     * @param userids    推送用户
     * @param check_type 公司或单位
     */
    public void dutyTipInfo(List<String> userids, int check_type) {
        String title;
        String msgContent;
        if (check_type == 0) {
            title = "【超高压输电公司对各单位安全生产过程问题整改-整改措施制定】";
            msgContent = "请完成本业务领域整改措施制定";
        } else {
            title = "【单位对各部门安全生产过程问题整改-整改措施制定】";
            msgContent = "请完成本业务领域整改措施制定";
        }
        if (userids.size() > 0) {
            sendTextMsgByList(userids, null, title, msgContent);
        }
    }

    /**
     * 整改措施制定（待审核）
     *
     * @param userids    推送用户
     * @param check_type 公司或单位
     */
    public void rectifyTipInfo(List<String> userids, int check_type, int ftype) {
        String title;
        String msgContent;
        if (check_type == 0) {
            title = "【超高压输电公司对各单位安全生产过程问题整改-整改措施审核】";
            msgContent = "请完成本业务领域整改措施审核";
        } else {
            title = "【单位对各部门安全生产过程问题整改-整改措施审核】";
            if (ftype == 1) {
                msgContent = "请完成本业务领域整改措施审核（专业部门审核）";
            } else {
                msgContent = "请完成本业务领域整改措施审核（安监部门审核）";
            }
        }
        if (userids.size() > 0) {
            sendTextMsgByList(userids, null, title, msgContent);
        }
    }

    /**
     * 整改措施审核（待安监审核）
     *
     * @param userids 推送用户
     * @param result  专业部门审核结果
     */
    public void manageApproveTipInfo(List<String> userids, int result) {
        String title;
        String msgContent;
        if (result == 1) {
            title = "【单位对各部门安全生产过程问题整改-整改措施审核】";
            msgContent = "本业务领域单位对各部门专业检查发现问题的专业部门审核结果为审核不通过";
        } else {
            title = "【单位对各部门安全生产过程问题整改-整改措施审核】";
            msgContent = "请完成本业务领域整改措施审核（安监部门审核）";
        }
        if (userids.size() > 0) {
            sendTextMsgByList(userids, null, title, msgContent);
        }
    }

    /**
     * 整改措施审核【单位】（待落实）
     *
     * @param userids 推送用户
     * @param result  安监部门审核结果
     */
    public void reviewApproveTipInfo(List<String> userids, int result) {
        String title;
        String msgContent;
        if (result == 1) {
            title = "【单位对各部门安全生产过程问题整改-整改措施审核】";
            msgContent = "本业务领域单位对各部门专业检查发现问题的安监部门审核结果为审核不通过";
        } else {
            title = "【单位对各部门安全生产过程问题整改-整改措施落实】";
            msgContent = "请完成本业务领域整改措施落实";
        }
        if (userids.size() > 0) {
            sendTextMsgByList(userids, null, title, msgContent);
        }
    }

    /**
     * 整改措施审核【公司】（待落实）
     *
     * @param userids 推送用户
     * @param result  安监部门审核结果
     */
    public void approveTipInfo(List<String> userids, int result) {
        String title;
        String msgContent;
        if (result == 1) {
            title = "【超高压输电公司对各单位安全生产过程问题整改-整改措施审核】";
            msgContent = "本业务领域公司对各单位专业检查发现问题的安监部门审核结果为审核不通过";
        } else {
            title = "【超高压输电公司对各单位安全生产过程问题整改-整改措施落实】";
            msgContent = "请完成本业务领域整改措施落实";
        }
        if (userids.size() > 0) {
            sendTextMsgByList(userids, null, title, msgContent);
        }
    }

    /**
     * 整改措施落实（待验收）
     *
     * @param userids    推送用户
     * @param check_type 公司或单位
     */
    public void commitTipInfo(List<String> userids, int check_type, int ftype) {
        String title;
        String msgContent;
        if (check_type == 0) {
            title = "【超高压输电公司对各单位安全生产过程问题整改-整改措施验收】";
            msgContent = "请完成本业务领域整改措施验收";
        } else {
            title = "【单位对各部门安全生产过程问题整改-整改措施验收】";
            if (ftype == 1) {
                msgContent = "请完成本业务领域整改措施验收（专业部门验收）";
            } else {
                msgContent = "请完成本业务领域整改措施验收（安监部门验收）";
            }
        }
        if (userids.size() > 0) {
            sendTextMsgByList(userids, null, title, msgContent);
        }
    }

    /**
     * 整改措施验收
     *
     * @param userids    推送用户
     * @param check_type 公司或单位
     */
    public void completeTipInfo(List<String> userids, int check_type) {
        String title;
        String msgContent;
        if (check_type == 0) {
            title = "【超高压输电公司对各单位安全生产过程问题整改-整改措施验收】";
            msgContent = "本业务领域公司对各单位专业检查发现问题的安监部门验收结果为验收不通过";
        } else {
            title = "【单位对各部门安全生产过程问题整改-整改措施验收】";
            msgContent = "本业务领域单位对各部门专业检查发现问题的安监部门验收结果为验收不通过";
        }
        if (userids.size() > 0) {
            sendTextMsgByList(userids, null, title, msgContent);
        }
    }

    /**
     * 删除整改措施
     *
     * @param userids 推送用户
     */
    public void rectifyDeleteTipInfo(List<String> userids, int check_type, String text) {
        String title;
        String msgContent;
        if (check_type == 0) {
            title = "【超高压输电公司对各单位安全生产过程问题整改】";
            msgContent = "由您导入的《" + text + "》整改问题已经被安监部门人员删除";
        } else {
            title = "【单位对各部门安全生产过程问题整改】";
            msgContent = "由您导入的《" + text + "》整改问题已经被安监部门人员删除";
        }
        if (userids.size() > 0) {
            sendTextMsgByList(userids, null, title, msgContent);
        }
    }

    public void manageCompleteTipInfo(List<String> userList, int result) {
        String title;
        String msgContent;
        if (result == 1) {
            title = "【单位对各部门安全生产过程问题整改-整改措施验收】";
            msgContent = "本业务领域单位对各部门专业检查发现问题的专业部门验收结果为验收不通过";
        } else {
            title = "【单位对各部门安全生产过程问题整改-整改措施验收】";
            msgContent = "请完成本业务领域整改措施验收（安监部门验收）";
        }
        if (userList.size() > 0) {
            sendTextMsgByList(userList, null, title, msgContent);
        }
    }
}
